import java.util.Scanner;

public class Text2 {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        String a = sc.nextLine();
        String b = sc.nextLine();
        int ret=0;

        for (int i = 0; i < a.length(); i++) {
            int tmp=0;
            for (int j = 0; j < b.length(); j++) {
                int cur2 = j;
                int cur1 = i;
                while((a.charAt(cur1)==b.charAt(cur2))&&(cur1<a.length()-1&&cur2<b.length()-1)){
                    cur1++;
                    cur2++;
                    tmp++;
                }
                if (cur1==a.length()-1||cur2==b.length()-1){
                    if (a.charAt(cur1)==b.charAt(cur2)){
                        tmp+=1;
                    }
                }
                if (tmp>ret){
                    ret=tmp;
                }
                tmp=0;
            }
        }

        System.out.println(ret);
    }
}
